#pragma once

#include <memory>
#include <vector>
#include "classfile/member_info.h"
//#include "instructions/base/bytecode_reader.h"
#include "instructions/base/instructions.h"
#include "rtda/thread.h"
#include "rtda/frame.h"
// #include "rtda/heap/class_loader.h"
#include "rtda/heap/method.h"

namespace jvm {

class Interpreter {
public:
    //static void interpret(std::shared_ptr<heap::Method> methodInfo, 
    //    bool logInst, 
    //    const std::vector<std::string>& args);

    static void interpret(std::shared_ptr<rtda::Thread> thread, bool logInst);

private:
    static void loop(std::shared_ptr<rtda::Thread> thread, bool logInst);
    static void catchErr(std::shared_ptr<rtda::Thread> thread);

    static void logFrames(std::shared_ptr<rtda::Thread> thread);

    static void logInstruction(std::shared_ptr<rtda::Frame> frame, std::shared_ptr<instructions::Instruction> inst);
    static void logInstruction(std::shared_ptr<rtda::Frame> frame, instructions::Instruction* inst);

};

} // namespace jvm